<% content_for :page_head do %>
  <h1>所有项目列表</h1>
<% end %>

<table cellspacing="0" cellpadding="0">
  <thead>
  <tr>
    <th>项目名</th>
    <th>KEY</th>
    <th>负责人</th>
    <th>起始于</th>
    <th>应完成于</th>
    <th>实际完成时间</th>
    <th>状态</th>
    <th>优先级</th>
  </tr>
  </thead>
  <tbody>
<% for project in @projects %>
  <tr>
    <td><%= link_to h(project.name), project %></td>
    <td><%= project.key %></td>
    <td><%= link_to h(project.user.name), project.user %></td>
    <td><%= project.start_time %></td>
    <td><%= project.should_be_finish_time %></td>
    <td><%= project.actually_finish_time %></td>
    <td><%= trans_current_state_to_chs(project.state) %></td>
    <% if current_user.has_role?("pdm") %>
    <% @project = project %>
    <td><%= in_place_editor_field :project, :priority %></td>
    <% else %>
    <td><%= project.priority %></td>
    <% end %>
  </tr>
<% end %>
  </tbody>
</table>

<%= will_paginate @projects, :previous_label => "", :next_label => "下一页 &raquo;" %>

<% content_for :right_side do %>
<div id="the_other_control">
<%= link_to image_tag("add_icon.gif"), new_project_path, :class=>"image" %>
<%= link_to "新建项目", new_project_path, :class=>"grey" %>
</div>

<% end %>